// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 更新请求 PUT /api/user */
export async function updateUser(
  body: API.UpdateUserInfoRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseLong>('/api/user', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据id获取用户信息 GET /api/user/${param0} */
export async function getUserById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUserByIdParams,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.LoginUserVo>(`/api/user/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 删除用户 DELETE /api/user/${param0} */
export async function deleteUser(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteUserParams,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseLong>(`/api/user/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 根据id更新用户countPromotion GET /api/user/${param0}/${param1} */
export async function updateUserCountPromotion(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateUserCountPromotionParams,
  options?: { [key: string]: any },
) {
  const { id: param0, countPromotion: param1, ...queryParams } = params;
  return request<any>(`/api/user/${param0}/${param1}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 校验用户名或者邮箱是否存在 GET /api/user/check/${param0} */
export async function checkUsername(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.checkUsernameParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean>(`/api/user/check/${params}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/** 校验邮箱是否为当前账户 GET /api/user/check/email/current/${param0} */
export async function checkEmailIsCurrent(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.checkEmailIsCurrentParams,
  options?: { [key: string]: any },
) {
  const { email: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(`/api/user/current/${param0}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/** 注册获取验证码 GET /api/user/code/${param0} */
export async function getCode(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getCodeParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean>(`/api/user/code/${params}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/** 消费 POST /api/user/consume/${param0} */
export async function consumeAmount(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.consumeAmountParams,
  options?: { [key: string]: any },
) {
  const { amount: param0, ...queryParams } = params;
  return request<API.BaseResponse>(`/api/user/consume/${param0}`, {
    method: 'POST',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 获取当前用户信息 GET /api/user/current/info */
export async function getCurrentUserInfo(options?: { [key: string]: any }) {
  return request<API.BaseResponseLoginUserVo>('/api/user/current/info', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 登录请求 POST /api/user/login */
export async function login(body: API.UserLoginRequest, options?: { [key: string]: any }) {
  return request<API.BaseResponseString>('/api/user/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 登录请求 POST /api/user/loginWithEmail */
export async function userLoginWithEmail(
  body: API.UserLoginWithEmailRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseString>('/api/user/loginWithEmail', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 退出 POST /api/user/logout */
export async function logout(options?: { [key: string]: any }) {
  return request<API.BaseResponseBoolean>('/api/user/logout', {
    method: 'POST',
    ...(options || {}),
  });
}

/** 充值 POST /api/user/recharge/${param0} */
export async function reChargeAmount(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.reChargeAmountParams,
  options?: { [key: string]: any },
) {
  const { amount: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(`/api/user/recharge/${param0}`, {
    method: 'POST',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 注册请求 POST /api/user/register */
export async function register(body: API.UserRegisterRequest, options?: { [key: string]: any }) {
  return request<API.BaseResponseLong>('/api/user/register', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更改密码请求 POST /api/user/update/passwd */
export async function updatePassword(
  body: API.UpdatePasswordRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean>('/api/user/update/passwd', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新count POST /api/user/update/promotion/${param0} */
export async function updateCountPromotion(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateCountPromotionParams,
  options?: { [key: string]: any },
) {
  const { countPromotion: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(`/api/user/update/promotion/${param0}`, {
    method: 'POST',
    params: { ...queryParams },
    ...(options || {}),
  });
}
